package com.qudian.pay.schedule.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @Description: 登录名密码
 * @ClassName: UserEnum
 * @author gaoxiang
 * @date 2016年5月20日 上午11:08:10
 */ 
public enum UserEnum {
	
	admin("admin", "123456"), 
	guest("guest", "123456");
	
	private String userName;
	
	private String password;
	
	UserEnum(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}
	
	public String getUserName() {
		return userName;
	}
	
	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public static UserEnum login(String userName, String password) {
		if(StringUtils.isBlank(userName) || StringUtils.isBlank(password)){
			return null;
		}
		for(UserEnum userEnum : UserEnum.values()){
			if(userEnum.getUserName().equals(userName) && userEnum.getPassword().equals(password)){
				return userEnum;
			}
		}
		return null;
	}
	
}
